package com.dq.controller.op.opmerchant.message;

import com.dq.annotation.aop.SysLog;
import com.dq.exception.customException.AdminException;
import com.dq.vo.Vo;
import com.dq.domain.message.custome.ServiceMessage;
import com.dq.service.AllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

/**
 * @author cf
 */
@Api(description = "服务消息")
@RestController
@RequestMapping("sys/org/serviceMessage/")
public class ServiceMessageMessageController extends AllService {

    @ApiOperation("删除")
    @SysLog("删除")
    @PostMapping("/delete/{id}")
    @RequiresPermissions("sys:serviceMessage:delete")
    public Vo delete(@PathVariable @ApiParam(value = "id") Long id) throws AdminException {
        ServiceMessage orgPositionQuery = dao.get(ServiceMessage.class, id);
        if (orgPositionQuery == null) {
            throw new AdminException("无对应id对象");
        }

        orgPositionQuery.setDeleted(true);
        serviceMessageService.update(orgPositionQuery);
        return new Vo(HttpStatus.OK);
    }
}
